package com.xiaoyuanxing.demo.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.xiaoyuanxing.demo.entity.School;
import com.xiaoyuanxing.demo.mapper.SchoolCollegeMapper;
import com.xiaoyuanxing.demo.mapper.SchoolMapper;
import com.xiaoyuanxing.demo.service.SchoolService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/*
 **@author LuoShengYing
 **@date 2021/5/23
 */
@Service("schoolService")
public class SchoolServiceImpl implements SchoolService {
    @Resource
    private SchoolMapper schoolMapper;

    @Resource
    private SchoolCollegeMapper schoolCollegeMapper;

    @Override
    public Page<School> getAllSchools(int pageNum, int pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        return schoolMapper.selectList();
    }

    @Override
    public List<String> getCollegesBySchoolID(int schoolID) {
        return schoolCollegeMapper.selectListBySchoolID(schoolID);
    }

    @Override
    public String getSchoolNameBySchoolID(int schoolID) {
        return schoolMapper.selectSchoolNameBySchoolID(schoolID);
    }
}
